package com.kebabeaters.nakebab.shared.dto.structures;

import com.google.gwt.user.client.rpc.IsSerializable;

public class Mark implements IsSerializable {	
	private Integer meat;
	private Integer sauce;
	private Integer vegetables;
	private Integer bread;
	private Integer priceForSize;
	private Taster taster;
	private String date;
	private Integer plusCount;
	private Integer minusCount;
	
	public float getEvaluation() {
		float plusPercent = plusCount / (plusCount + minusCount);
		
		return plusPercent * plusCount;
	}
	
	public float getAverage() {
		return (meat + sauce + vegetables + bread + priceForSize) / 5;
	}

	public Integer getMeat() {
		return meat;
	}

	public void setMeat(Integer value) {
		if ((value > 5) || (value < 1)) {
			throw new IllegalStateException("Mark outside of <1, 5> range");
		} else {
			this.meat = value;
		}
	}

	public Integer getSauce() {
		return sauce;
	}

	public void setSauce(Integer value) {
		if ((value > 5) || (value < 1)) {
			throw new IllegalStateException("Mark outside of <1, 5> range");
		} else {
			this.sauce = value;
		}
	}

	public Integer getVegetables() {
		return vegetables;
	}

	public void setVegetables(Integer value) {
		if ((value > 5) || (value < 1)) {
			throw new IllegalStateException("Mark outside of <1, 5> range");
		} else {
			this.vegetables = value;
		}
	}

	public Integer getBread() {
		return bread;
	}

	public void setBread(Integer value) {
		if ((value > 5) || (value < 1)) {
			throw new IllegalStateException("Mark outside of <1, 5> range");
		} else {
			this.bread = value;
		}
	}

	public Integer getPriceForSize() {
		return priceForSize;
	}

	public void setPriceForSize(Integer value) {
		if ((value > 5) || (value < 1)) {
			throw new IllegalStateException("Mark outside of <1, 5> range");
		} else {
			this.priceForSize = value;
		}
	}

	public Taster getTaster() {
		return taster;
	}

	public void setTaster(Taster taster) {
		this.taster = taster;
	}

	public String getDate() {
		return date;
	}

	public void setDate(String date) {
		this.date = date;
	}

	public Integer getPlusCount() {
		return plusCount;
	}

	public void setPlusCount(Integer plusCount) {
		this.plusCount = plusCount;
	}

	public Integer getMinusCount() {
		return minusCount;
	}

	public void setMinusCount(Integer minusCount) {
		this.minusCount = minusCount;
	}
}
